<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    function factorial(num) {
        if (num <= 1) {
            return 1;
        } else {
            return factorial(num - 1) * num;
        }
    }

    function factorialAndAdd(num) {
        if (num <= 1) {
            return 1;
        } else if (num == 2) {
            return factorial(num - 1) + factorial(num);
        } else {
            return factorialAndAdd(num - 1) + factorial(num);
        }
    }

    var result = factorialAndAdd(3);
    document.write(result);
    document.write("<br\>");

    function peachQuestion(num) {
        if (num <= 1) {
            return 1;
        } else {
            return (peachQuestion(num - 1) + 1) * 2;
        }
    }

    var result2 = peachQuestion(10)
    document.write(result2);
</script>

</body>
</html>